package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.dto.ReplyDTO;
import com.tianji.learning.domain.query.ReplyPageQuery;
import com.tianji.learning.domain.vo.ReplyVO;
import com.tianji.learning.service.IInteractionReplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 回答、评论相关接口
 * </p>
 *
 * @author LYQ
 * @since 2024-06-25
 */
@RestController
@RequestMapping("/replies")
@Api(tags = "回答、评论相关接口")
@RequiredArgsConstructor
public class InteractionReplyController {
    private final IInteractionReplyService replyService;

    /**
     * 新增回答或评论
     *
     * @param replyDTO
     */
    @PostMapping
    @ApiOperation("新增回答、评论")
    public void addReply(@RequestBody ReplyDTO replyDTO) {
        replyService.addReply(replyDTO);
    }


    /**
     * 用户端 - 分页查询回答或评论列表
     *
     * @param pageQuery
     */
    @GetMapping("/page")
    @ApiOperation("用户端 - 分页查询回答或评论列表")
    public PageDTO<ReplyVO> replypage(ReplyPageQuery pageQuery) {
        return replyService.replypage(pageQuery);
    }
}
